<template>
  <div class="person">
    <div>RouterDemo</div>
    <RouterView />
    <button @click="jump('router-a')">RouterA</button>
    <button @click="jump('router-b')">RouterB</button>
    <button @click="jump('pinia-demo')">跳转到piniaDemo</button>
    <button @click="goBack">返回</button>
  </div>
</template>

<script lang="ts" setup name="RouterDemo">
import { useRouter } from 'vue-router';
const router = useRouter();
const jump = (name:string) => {
  router.push({
    name,
    query: {
      id: 1,
    },
  });
}
const goBack = () => {
  router.back();
}
</script>